package com.iwhalecloud.uncc.common;

import com.alibaba.ttl.TransmittableThreadLocal;
import com.iwhalecloud.uncc.domain.ArchiveParam;

/**
 * @author zq
 * @date 2021/10/15 16:35
 * @description 跨越线程池 TransmittableThreadLocal
 */
public class ArchiverThreadLocal {
    private static final ThreadLocal<ArchiveParam> archiverThreadLocal = new TransmittableThreadLocal<>();

    private ArchiverThreadLocal() {
    }

    public static ArchiveParam getArchiveParam() {
        return (ArchiveParam) archiverThreadLocal.get();
    }

    public static void setArchiveParam(ArchiveParam archiveParam) {
        archiverThreadLocal.set(archiveParam);
    }

    public static void removeArchiveParam() {
        archiverThreadLocal.remove();
    }
}
